package com.topwater.topwater.service.impl;

import com.topwater.topwater.entity.SySurcharge;
import com.topwater.topwater.dao.SySurchargeDao;
import com.topwater.topwater.service.SySurchargeService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;

import javax.annotation.Resource;

/**
 * (SySurcharge)表服务实现类
 *
 * @author 胡文 qq:986776
 *自定义生成器制造
 */
@Service("sySurchargeService")
public class SySurchargeServiceImpl  implements SySurchargeService {
    @Resource
    private SySurchargeDao sySurchargeDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public SySurcharge queryById(Integer id) {
        return this.sySurchargeDao.queryById(id);
    }

 
    /**
     * 新增数据
     *
     * @param sySurcharge 实例对象
     * @return 实例对象
     */
    @Override
    public SySurcharge insert(SySurcharge sySurcharge) {
        this.sySurchargeDao.insert(sySurcharge);
        return sySurcharge;
    }
  @Override
    public SySurcharge insertNotNull(SySurcharge sySurcharge) {
        this.sySurchargeDao.insertNotNull(sySurcharge);
        return sySurcharge;
    }
    /**
     * 修改数据
     *
     * @param sySurcharge 实例对象
     * @return 实例对象
     */
    @Override
    public SySurcharge update(SySurcharge sySurcharge) {
        this.sySurchargeDao.update(sySurcharge);
        return this.queryById(sySurcharge.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.sySurchargeDao.deleteById(id) > 0;
    }
    /**
    *字符串自动模糊查询
    **/
    public List<SySurcharge> queryByLike(SySurcharge sySurcharge){
        return this.sySurchargeDao.queryByLike(sySurcharge);
    }
    
    public List<SySurcharge> queryByLike2(String str){
         return this.sySurchargeDao.queryByLike2(str);
    }
    /**
    *多表连接查询
    */
    public List<Map> queryJoin(@Param("sySurcharge")  SySurcharge sySurcharge, @Param("tables") String... tables){
         return this.sySurchargeDao.queryJoin(sySurcharge,tables);
    }
}
